package com.ems.util;


/**
 * 分页工具类
 */
public class PageUtil {

    private int pageNo; // 页码

    private int pageSize = 10; // 每页数量

    private int totalPage; // 总页数

    private int totalNum; // 总记录数

    public PageUtil ( int pageNo, int totalNum ) {
        this.totalNum = totalNum;
        this.pageNo = pageNo;
    }

    public int getTotalPage () {
        if ( totalNum % getPageSize () == 0 ) {
            totalPage = totalNum / getPageSize ();
        } else {
            totalPage = totalNum / getPageSize () + 1;
        }
        return totalPage;
    }

    public int getPageNo () {
        return pageNo;
    }

    public void setPageNo ( int pageNo ) {
        this.pageNo = pageNo;
    }

    public int getPageSize () {
        return pageSize;
    }

    public void setPageSize ( int pageSize ) {
        this.pageSize = pageSize;
    }

    public void setTotalPage ( int totalPage ) {
        this.totalPage = totalPage;
    }

    public int getTotalNum () {
        return totalNum;
    }

    public void setTotalNum ( int totalNum ) {
        this.totalNum = totalNum;
    }
}
